const { contextBridge,ipcRenderer  } = require('electron')
const path = require('path')
console.log("preload",path,__dirname)
// 暴露 API 给渲染进程
contextBridge.exposeInMainWorld('electronAPI', {
    // 定义一个发送消息到主进程的函数
    sendMessage: (channel, data) => {
        ipcRenderer.send(channel, data);
    },
    // 定义一个监听主进程消息的函数
    receiveMessage: (channel, func) => {
        ipcRenderer.on(channel, (event, ...args) => func(...args));
    }
});
